<template>
	<view class="page">
		<tui-button type="danger" @click="gotoUrl">点击跳转到商城页面</tui-button>
		<tui-loading text="正在跳转中" v-if="loading"></tui-loading>
	</view>
</template>

<script>
export default {
	data() {
		return {
			wxAppId: 'wxdc2eb1c92e44d621',
			shopUrl: 'http://bdy.gzgycd.com/',
			loading: true
		};
	},
	onReady() {
		// this.gotoUrl();
	},
	onShow() {
		setTimeout(() => {
			this.gotoUrl();
		}, 500);
	},
	onHide() {
	},
	methods: {
		
		gotoUrl: function(){
			// #ifdef MP-WEIXIN
			//console.log(this.wxAppId);
			wx.navigateToMiniProgram({
				appId: this.wxAppId,
				complete(res) {
					//this.loading = false;
					uni.switchTab({
					    url: '/pages/index/index'
					});
				}
			});
			
			// #endif
			
			// #ifdef H5
			console.log(this.shopUrl);
			location.href = this.shopUrl;
			// #endif
		}
	}
};
</script>

<style>
	.page{
		text-align: center;
		margin: 200rpx 50rpx 0;
	}
</style>
